new Vue({
	el: '#app',
	data: {
		uid: '',
		user: '',
		path: '',
		moneyList: [],
		money: '',
		page: '1'
	},
	mounted: function() {
		this.init();
	},
	methods: {
		init: function() {
			this.uid = $api.getStorage('uid');
			if(this.uid) {
				this.getUserMsg();
			} else {
				api.toast({
					msg: "no uid",
					duration: 2000,
					location: 'middle'
				});
			}
		},
		getUserMsg: function() {
			var self = this;
			apiready = function() {
				self.myWallet();
			};
		},
		//充值
		myWallet: function() {
			var self = this;
			console.log(self.uid);
			var data = {
				user_id: self.uid
			};
			$.post(base + config.user_money, data, function(msg) {
				console.log(msg);
				if(msg.error == 0) {
					self.moneyList = msg.data;
					if(msg.money) {
						self.money = msg.money;
					} else {
						self.money = 0;
					}
					self.pageCount = msg.page_count;
				} else {
					console.log(msg.error_msg);
					api.toast({
						msg: msg.error_msg,
						duration: 2000,
						location: 'middle'
					});
				}
			}, 'json');
		}
	}
})